package com.vueperson.vueperson.pattern;

public class SingletonPattern {
    //创建 SingleObject 的一个对象
    private static Object instance = new Object();

    //让构造函数为 private，这样该类就不会被实例化
    private SingletonPattern(){}

    //获取唯一可用的对象
    public static SingletonPattern getInstance(){
        return (SingletonPattern) instance;
    }

    public void showMessage(){
        System.out.println("Hello World!");
    }


}
